<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title></title>
    <style type="text/css">
        #DivQuery {
            position: absolute;
            left: 1px;
            top: 60px;
        }

        #Mytable {
            position: absolute;
            top: 150px;
            left: 83px;
            width: 1200px;
        }

        nav {
            position: absolute;
            top: 540px;
            left: 430px;
        }

        nav > ul > li > a {
            width: 70px;
        }
        .col-lg-6 ul li a,
        .col-lg-6 ul li span{
            background-color: transparent;
        }
        .col-lg-6 ul li a:hover,
        .col-lg-6 ul li a:focus,
        .col-lg-6 ul li span:hover,
        .col-lg-6 ul li span:focus{
            background-color: transparent;
        }
        .pagination > .disabled > span,
        .pagination > .disabled > span:hover,
        .pagination > .disabled > span:focus,
        .pagination > .disabled > a,
        .pagination > .disabled > a:hover,
        .pagination > .disabled > a:focus {
            color: #777;
            cursor: not-allowed;
            background-color:transparent;
            border-color: #ddd;
        }
        #Mytop{
            position: fixed;
            width: 100%;
            top: 0px;
            left: 0px;
            z-index: 1;
        }
    </style>
    <link rel="stylesheet" href="static/css/bootstrap.css"/>
</head>
<body style="background-image: url(static/images/bg-01.jpg); background-size: 100%; z-index: -1;">
<nav class="navbar navbar-default" id="Mytop">
    <div class="container-fluid">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
        </div>
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav">
                <li class="">
                   <a>欢迎使用</a>
                </li>
            </ul>
            <ul class="nav navbar-nav navbar-brand" style="position: absolute; left: 630px;">
                <li>APP审核管理</li>
            </ul>
            <ul class="nav navbar-nav navbar-right">
                <li><a>管理员:${userSession.userCode}</a></li>
            </ul>
        </div>
    </div>
</nav>
<div id="DivQuery">
    <div class="container">
        <div class="row">
            <form method="post" action="list">
                <div class="col-lg-2 col-xs-2 col-lg-offset-2 col-xs-offset-2">
                    <label>软件名称</label>
                    <input name="querySoftwareName" type="text" class="form-control col-md-7 col-xs-12" value="">
                </div>
                <div class="col-lg-2 col-xs-2 col-lg-offset-2 col-xs-offset-2">
                    <label>所属平台</label>
                    <select name="queryFlatformId" class="form-control">
                        <c:if test="${flatFormList != null }">
                            <option value="">--请选择--</option>
                            <c:forEach var="dataDictionary" items="${flatFormList}">
                                <option
                                        <c:if test="${dataDictionary.valueId == queryFlatformId }">selected="selected"</c:if>
                                        value="${dataDictionary.valueId}">${dataDictionary.valueName}</option>
                            </c:forEach>
                        </c:if>
                    </select>
                </div>
                <div class="col-lg-2 col-xs-2 col-lg-offset-2 col-xs-offset-2">
                    <label>一级分类</label>
                    <select id="queryCategoryLevel1" name="queryCategoryLevel1" class="form-control">
                        <c:if test="${categoryLevel1List != null }">
                            <option value="">--请选择--</option>
                            <c:forEach var="appCategory" items="${categoryLevel1List}">
                                <option
                                        <c:if test="${appCategory.id == queryCategoryLevel1 }">selected="selected"</c:if>
                                        value="${appCategory.id}">${appCategory.categoryName}</option>
                            </c:forEach>
                        </c:if>
                    </select>
                </div>
                <div class="col-lg-2 col-xs-2 col-lg-offset-2 col-xs-offset-2">
                    <label>二级分类</label>
                    <select name="queryCategoryLevel2" id="queryCategoryLevel2" class="form-control">
                        <c:if test="${categoryLevel2List != null }">
                            <option value="">--请选择--</option>
                            <c:forEach var="appCategory" items="${categoryLevel2List}">
                                <option
                                        <c:if test="${appCategory.id == queryCategoryLevel2 }">selected="selected"</c:if>
                                        value="${appCategory.id}">${appCategory.categoryName}</option>
                            </c:forEach>
                        </c:if>
                    </select>
                </div>
                <div class="col-lg-2 col-xs-2 col-lg-offset-2 col-xs-offset-2">
                    <label>三级分类</label>
                    <select name="queryCategoryLevel3" id="queryCategoryLevel3" class="form-control">
                        <c:if test="${categoryLevel3List != null }">
                            <option value="">--请选择--</option>
                            <c:forEach var="appCategory" items="${categoryLevel3List}">
                                <option
                                        <c:if test="${appCategory.id == queryCategoryLevel3 }">selected="selected"</c:if>
                                        value="${appCategory.id}">${appCategory.categoryName}</option>
                            </c:forEach>
                        </c:if>
                    </select>
                </div>
                <div class="col-lg-2 col-xs-2 col-lg-offset-2 col-xs-offset-2">
                    <button type="submit" class="btn btn-primary" style="width: 166px; position: absolute; top: 24px">查&nbsp;&nbsp;询</button>
                </div>
            </form>
        </div>
</div>
<div class="container" id="Mytable">
    <div class="row">
        <div class="col-xs-12">
            <table class="table table-condensed" >
                <th>软件名称</th>
                <th>APK名称</th>
                <th>软件大小(单位:M)</th>
                <th>所属平台</th>
                <th>所属分类(一级分类、二级分类、三级分类)</th>
                <th>状态</th>
                <th>下载次数</th>
                <th>最新版本号</th>
                <th>操作</th>
                <c:forEach var="appInfo" items="${appInfoList}" varStatus="status">
                    <tr role="row" class="odd">
                        <td tabindex="0" class="sorting_1">${appInfo.softwareName}</td>
                        <td>${appInfo.APKName }</td>
                        <td>${appInfo.softwareSize }</td>
                        <td>${appInfo.flatformName }</td>
                        <td>${appInfo.categoryLevel1Name } -> ${appInfo.categoryLevel2Name } -> ${appInfo.categoryLevel3Name }</td>
                        <td>${appInfo.statusName }</td>
                        <td>${appInfo.downloads }</td>
                        <td>${appInfo.versionNo }</td>
                        <td>
                            <button type="button" class="btn btn-success checkApp"
                                    appinfoid="${appInfo.id}" versionid="${appInfo.versionId}" status="${appInfo.status }"
                                    statusname="${appInfo.statusName }"
                                    data-toggle="tooltip" data-placement="top" title="" data-original-title="查看并审核APP">审核
                            </button>
                        </td>
                    </tr>
                </c:forEach>
            </table>
        </div>
    </div>
</div>
<div class="container" style="position: fixed; left: 101px; top: 0px;">
    <div class="row">
        <nav class="col-lg-6" aria-label="Page navigation" style="opacity: 0.8;">
            <ul class="pagination" style="border: 1px solid aqua;">
                <li id="prev">
                    <a href="list?pageIndex=${pages.currentPageNo-1}" aria-label="Previous">
                        <span aria-hidden="true">&laquo;</span>
                    </a>
                </li>
                <c:forEach begin="1" end="${pages.totalPageCount}" varStatus="sta">
                    <li><a style="border: 1px solid aqua; color: black;" href="list?pageIndex=${sta.count}">${sta.count}</a></li>
                </c:forEach>
                <li id="next">
                    <a href="list?pageIndex=${pages.currentPageNo+1}" aria-label="Next">
                        <span aria-hidden="true">&raquo;</span>
                    </a>
                </li>
            </ul>
        </nav>
    </div>
</div>
</div>
</body>
<script type="text/javascript" src="static/js/jquery-3.3.1.js"></script>
<script type="text/javascript" src="static/js/bootstrap.js"></script>
<script src="static/localjs/rollpage.js"></script>
<script src="static/localjs/applist.js"></script>
<script type="text/javascript">
    $(function () {
        var pageIndex =${pages.currentPageNo};
        var totalPageCount =${pages.totalPageCount};
        if (pageIndex == totalPageCount || pageIndex > totalPageCount) {
            $("#next").addClass("disabled");
        }
        if (pageIndex != totalPageCount) {
            $("#next").removeClass("disabled");
        }
        if (pageIndex == 1) {
            $("#prev").addClass("disabled");
        }
        if (pageIndex != 1) {
            $("#prev").removeClass("disabled");
        }
        $("#sh").click(function () {
            $("#DivTop").css("display","block");
        })
    });
</script>
</html>